/**
 * \file InData.h
 * \authors Ameen Jaber
 * \authors Mohamad Noureddine
 * \authors Mohamed Sabra
 * \brief Contains defintion of ppp type classes 
 */
#ifndef INDATA_H_
#define INDATA_H_

#include <util.h>
#include <vector>

/**
 * Define an object class for the variables in the input data file
 */
class object
{
 public:
  object() {
    val = 0;
  }
  virtual void print()
  {
    std::cout<<val<<' ';
  }
  object(int y) {
    val=y;
  }
  TP_Op_t type;
  int val;
};

/**
 * Define a class for the sequence
 */
class pppsequence: public object
{
 public:
  std::vector<object*>* data;
  virtual void print()
  {
    std::cout<<"< ";
    data->at(0)->print();
    for(int i=1; i<data->size(); i++)
      {
	std::cout<<", ";
	data->at(i)->print();
      }
    std::cout<<">";
  }
  pppsequence() {
    data = new std::vector<object*>();
  }
};

/**
 * Define a class for the set
 */
class pppset: public object
{
 public:
  std::vector<object*>* data;
  virtual void print()
  {
    std::cout<<"{ ";
    data->at(0)->print();
    for(int i=1; i<data->size(); i++)
      {
	std::cout<<", ";
	data->at(i)->print();
      }
    std::cout<<" }";
  }
  pppset() {
    data = new std::vector<object*>();
  }
};

/**
 * Define a pair for the relation and function composed of object
 */
typedef std::pair<object*,object*> Pair_t;


/**
 * Define a class for the function
 */
class pppfunction: public object
{public:
  std::vector<Pair_t*>* data;
  virtual void print()
  {
    std::cout<<"@[";
    for(int i=0; i<data->size(); i++)
      {
	std::cout<<'(';
	data->at(i)->first->print();
	std::cout<<" , ";
	data->at(i)->second->print();
	std::cout<<')';
      }
    std::cout<<"]@";
  }
  pppfunction() {
    data= new std::vector<Pair_t*>();
  }
};

/**
 * Define a class for the relation
 */
class ppprelation: public object
{public:
  std::vector<Pair_t*>* data;
  virtual void print()
  {
    std::cout<<"[ ";
    for(int i=0; i<data->size(); i++)
      {
	std::cout<<'(';
	data->at(i)->first->print();
	std::cout<<" , ";
	data->at(i)->second->print();
	std::cout<<')';
      }
    std::cout<<" ]";
  }
  ppprelation() {
    data= new std::vector<Pair_t*>();
  }
};

#endif
